/*
 * TimeGraphPane.java
 *
 * Created on January 11, 2008, 8:37 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package com.fie.contentpanes;

import com.fie.graphing.DrawStaticGraph;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;
import javax.swing.JPanel;

/**
 *
 * @author joseacuna-rohter
 */
public class TimeGraphPane extends JPanel{
    
    
    private JPanel totalGUI;
    private Image img; 
    /** Creates a new instance of TimeGraphPane */
    public TimeGraphPane() {
    }
    
    
    public Container createContentPane()
    {
        
      
        // We create a bottom JPanel to place everything on.
        totalGUI = new JPanel();
        
        // We set the Layout Manager to null so we can manually place
        // the Panels.
        totalGUI.setLayout(null);
        
        
       
        
       // DrawStaticGraph drawingPanel =  new DrawStaticGraph ("http://chart.finance.yahoo.com/c/3m/_/_ixic");
        Frame f = new Frame();
        
        DrawStaticGraph iv = new DrawStaticGraph("http://chart.finance.yahoo.com/c/3m/_/_ixic");
       // f.setLayout(new BorderLayout());
        f.add("Center", iv);
        f.pack();
        
       // totalGUI.add(drawingPanel);
        
        //drawingPanel.updateUI();
        
        return totalGUI;
        
     }
    
   public void  DrawingPanel (Image img) 
    { this.img = img; } 
    
    
  public void paintComponent (Graphics g) { 
       super.paintComponent (g); 

       // Use the image width & height to find the starting point
       int imgX = getSize ().width/2 - img.getWidth (this); 
       int imgY = getSize ().height/2 - img.getHeight (this);

       //Draw image centered in the middle of the panel    
       g.drawImage (img, imgX, imgY, this); 
  } // paintComponent

   
    
}
